/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package project.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.validation.constraints.NotNull;

/**
 *
 * @author Wolf
 */
@Entity
public class Evento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idEvento;
    
    @NotNull
    private String titulo;
    
    @NotNull
    private String tipo;
    
    @NotNull
    private String descricao;

    @OneToMany(mappedBy = "evento")
    private Collection<Submissao> submissoes;
    
    @NotNull
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataFimSubmissoes;
    
    @NotNull
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataFimRevisoes;
    
    @NotNull
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataRealizacao;
    
    @ManyToOne
    private Editor editor;

    public Evento() {
    }

    public Evento(String titulo, Collection<Submissao> submissoes, Date dataFimSubmissoes, Date dataFimRevisoes, Date dataRealizacao, Editor editor) {
        this.titulo = titulo;
        this.submissoes = submissoes;
        this.dataFimSubmissoes = dataFimSubmissoes;
        this.dataFimRevisoes = dataFimRevisoes;
        this.dataRealizacao = dataRealizacao;
        this.editor = editor;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getIdEvento() != null ? getIdEvento().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Evento)) {
            return false;
        }
        Evento other = (Evento) object;
        if ((this.getIdEvento() == null && other.getIdEvento() != null) || (this.getIdEvento() != null && !this.idEvento.equals(other.idEvento))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "project.entity.Evento[ id=" + getIdEvento() + " ]";
    }

    /**
     * @return the idEvento
     */
    public Long getIdEvento() {
        return idEvento;
    }

    /**
     * @param idEvento the idEvento to set
     */
    public void setIdEvento(Long idEvento) {
        this.idEvento = idEvento;
    }

    /**
     * @return the dataFimSubmissoes
     */
    public Date getDataFimSubmissoes() {
        return dataFimSubmissoes;
    }

    /**
     * @param dataFimSubmissoes the dataFimSubmissoes to set
     */
    public void setDataFimSubmissoes(Date dataFimSubmissoes) {
        this.dataFimSubmissoes = dataFimSubmissoes;
    }

    /**
     * @return the dataFimRevisoes
     */
    public Date getDataFimRevisoes() {
        return dataFimRevisoes;
    }

    /**
     * @param dataFimRevisoes the dataFimRevisoes to set
     */
    public void setDataFimRevisoes(Date dataFimRevisoes) {
        this.dataFimRevisoes = dataFimRevisoes;
    }

    /**
     * @return the dataRealizacao
     */
    public Date getDataRealizacao() {
        return dataRealizacao;
    }

    /**
     * @param dataRealizacao the dataRealizacao to set
     */
    public void setDataRealizacao(Date dataRealizacao) {
        this.dataRealizacao = dataRealizacao;
    }

    /**
     * @return the submissoes
     */
    public Collection<Submissao> getSubmissoes() {
        return submissoes;
    }

    /**
     * @param submissoes the submissoes to set
     */
    public void setSubmissoes(Collection<Submissao> submissoes) {
        this.submissoes = submissoes;
    }

    /**
     * @return the titulo
     */
    public String getTitulo() {
        return titulo;
    }

    /**
     * @param titulo the titulo to set
     */
    public void setTitulo(String titulo) {
        this.titulo = titulo;
    }

    /**
     * @return the editor
     */
    public Editor getEditor() {
        return editor;
    }

    /**
     * @param editor the editor to set
     */
    public void setEditor(Editor editor) {
        this.editor = editor;
    }

    /**
     * @return the tipo
     */
    public String getTipo() {
        return tipo;
    }

    /**
     * @param tipo the tipo to set
     */
    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    /**
     * @return the descricao
     */
    public String getDescricao() {
        return descricao;
    }

    /**
     * @param descricao the descricao to set
     */
    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }
    
}
